package com.maker.mcp.client.controller;


import com.maker.mcp.client.bean.ChatEntity;
import com.maker.mcp.client.service.ChatService;
import jakarta.annotation.Resource;
import org.springframework.ai.chat.model.ChatResponse;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;

@RestController
//@RequestMapping("chat")
public class ChatController {
    @Resource
    private ChatService chatService;
    @PostMapping("/doChat")
    public void chat(@RequestBody ChatEntity chatEntity){
        chatService.doChat(chatEntity);
    }

    @RequestMapping(value = "/chat", produces="text/html;charset=utf-8")
    public Flux<String> chat(String memoryId,String message){
        Flux<String> result = chatService.chat(memoryId,message);
        return result;
    }
}
